package com.kl.utils;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @author CC
 * time 2024-05-14
 * description
 *  集合工具
 */
public final class CollectionUtils {

    public static boolean isEmpty(Collection<?> collection){
        return collection==null ||collection.isEmpty();
    }
    public static boolean isEmpty(Map<?,?> map){
        return map==null || map.isEmpty();
    }

    public static<T> List<? extends T> orEmpty(List<? extends T> list,Class<T> clz){
        if (list==null||list.isEmpty()) {
            return Collections.emptyList();
        }
        return list;
    }

}
